package org.jasig.cas.services;

import java.util.ArrayList;
import java.util.List;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import org.jasig.cas.authentication.principal.Service;
import org.springframework.util.AntPathMatcher;
import org.springframework.util.PathMatcher;

@Entity
public class RegisteredServiceImpl implements RegisteredService, Comparable<RegisteredService> {
    private static final PathMatcher PATH_MATCHER = new AntPathMatcher();
    private static final long serialVersionUID = -5136788302682868276L;
    private boolean allowedToProxy = true;
    private boolean anonymousAccess = false;
    private String description;
    private boolean enabled = true;
    @Column(name = "evaluation_order", nullable = false)
    private int evaluationOrder;
    @GeneratedValue(strategy = GenerationType.AUTO)
    @Id
    /* renamed from: id */
    private long f0id = -1;
    private boolean ignoreAttributes = false;
    private String name;
    private String serviceId;
    private boolean ssoEnabled = true;
    private String theme;

    public boolean isAnonymousAccess() {
        return this.anonymousAccess;
    }

    public void setAnonymousAccess(boolean anonymousAccess) {
        this.anonymousAccess = anonymousAccess;
    }

    public List<String> getAllowedAttributes() {
        return new ArrayList<String>();
    }

    public long getId() {
        return this.f0id;
    }

    public String getDescription() {
        return this.description;
    }

    public String getServiceId() {
        return this.serviceId;
    }

    public String getName() {
        return this.name;
    }

    public String getTheme() {
        return this.theme;
    }

    public boolean isAllowedToProxy() {
        return this.allowedToProxy;
    }

    public boolean isEnabled() {
        return this.enabled;
    }

    public boolean isSsoEnabled() {
        return this.ssoEnabled;
    }

    public boolean matches(Service service) {
        return service != null && PATH_MATCHER.match(this.serviceId.toLowerCase(), service.getId().toLowerCase());
    }

    public boolean equals(Object o) {
        if (this == o) {
            return true;
        }
        if (!(o instanceof RegisteredServiceImpl)) {
            return false;
        }
        RegisteredServiceImpl that = (RegisteredServiceImpl) o;
        if (this.allowedToProxy != that.allowedToProxy) {
            return false;
        }
        if (this.anonymousAccess != that.anonymousAccess) {
            return false;
        }
        if (this.enabled != that.enabled) {
            return false;
        }
        if (this.evaluationOrder != that.evaluationOrder) {
            return false;
        }
        if (this.ignoreAttributes != that.ignoreAttributes) {
            return false;
        }
        if (this.ssoEnabled != that.ssoEnabled) {
            return false;
        }
        if (this.description == null ? that.description != null : !this.description.equals(that.description)) {
            return false;
        }
        if (this.name == null ? that.name != null : !this.name.equals(that.name)) {
            return false;
        }
        if (this.serviceId == null ? that.serviceId != null : !this.serviceId.equals(that.serviceId)) {
            return false;
        }
        if (this.theme != null) {
            if (this.theme.equals(that.theme)) {
                return true;
            }
        } else if (that.theme == null) {
            return true;
        }
        return false;
    }

    public int hashCode() {
        int hashCode;
        int i = 1;
        int hashCode2 = ((this.description != null ? this.description.hashCode() : 0) + 0) * 31;
        if (this.serviceId != null) {
            hashCode = this.serviceId.hashCode();
        } else {
            hashCode = 0;
        }
        hashCode2 = (hashCode2 + hashCode) * 31;
        if (this.name != null) {
            hashCode = this.name.hashCode();
        } else {
            hashCode = 0;
        }
        hashCode2 = (hashCode2 + hashCode) * 31;
        if (this.theme != null) {
            hashCode = this.theme.hashCode();
        } else {
            hashCode = 0;
        }
        hashCode2 = (hashCode2 + hashCode) * 31;
        if (this.allowedToProxy) {
            hashCode = 1;
        } else {
            hashCode = 0;
        }
        hashCode2 = (hashCode2 + hashCode) * 31;
        if (this.enabled) {
            hashCode = 1;
        } else {
            hashCode = 0;
        }
        hashCode2 = (hashCode2 + hashCode) * 31;
        if (this.ssoEnabled) {
            hashCode = 1;
        } else {
            hashCode = 0;
        }
        hashCode2 = (hashCode2 + hashCode) * 31;
        if (this.anonymousAccess) {
            hashCode = 1;
        } else {
            hashCode = 0;
        }
        hashCode = (hashCode2 + hashCode) * 31;
        if (!this.ignoreAttributes) {
            i = 0;
        }
        return ((hashCode + i) * 31) + this.evaluationOrder;
    }

    public void setAllowedAttributes(List<String> list) {
    }

    public void setAllowedToProxy(boolean allowedToProxy) {
        this.allowedToProxy = allowedToProxy;
    }

    public void setDescription(String description) {
        this.description = description;
    }

    public void setEnabled(boolean enabled) {
        this.enabled = enabled;
    }

    public void setServiceId(String id) {
        this.serviceId = id;
    }

    public void setId(long id) {
        this.f0id = id;
    }

    public void setName(String name) {
        this.name = name;
    }

    public void setSsoEnabled(boolean ssoEnabled) {
        this.ssoEnabled = ssoEnabled;
    }

    public void setTheme(String theme) {
        this.theme = theme;
    }

    public boolean isIgnoreAttributes() {
        return this.ignoreAttributes;
    }

    public void setIgnoreAttributes(boolean ignoreAttributes) {
        this.ignoreAttributes = ignoreAttributes;
    }

    public void setEvaluationOrder(int evaluationOrder) {
        this.evaluationOrder = evaluationOrder;
    }

    public int getEvaluationOrder() {
        return this.evaluationOrder;
    }

    public Object clone() throws CloneNotSupportedException {
        RegisteredServiceImpl registeredServiceImpl = new RegisteredServiceImpl();
        registeredServiceImpl.setAllowedToProxy(this.allowedToProxy);
        registeredServiceImpl.setDescription(this.description);
        registeredServiceImpl.setEnabled(this.enabled);
        registeredServiceImpl.setId(this.f0id);
        registeredServiceImpl.setName(this.name);
        registeredServiceImpl.setServiceId(this.serviceId);
        registeredServiceImpl.setSsoEnabled(this.ssoEnabled);
        registeredServiceImpl.setTheme(this.theme);
        registeredServiceImpl.setAnonymousAccess(this.anonymousAccess);
        registeredServiceImpl.setIgnoreAttributes(this.ignoreAttributes);
        registeredServiceImpl.setEvaluationOrder(this.evaluationOrder);
        return registeredServiceImpl;
    }

    public int compareTo(RegisteredService other) {
        int result = this.evaluationOrder - other.getEvaluationOrder();
        if (result == 0) {
            return (int) (this.f0id - other.getId());
        }
        return result;
    }
}
